package org.springblade.modules.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.modules.system.entity.FlowerType;
import org.springblade.modules.system.mapper.FlowerTypeMapper;
import org.springblade.modules.system.service.FlowerTypeService;
import org.springblade.utils.PageBounds;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FlowerTypeServiceImpl extends ServiceImpl<FlowerTypeMapper, FlowerType> implements FlowerTypeService {

	@Override
	public PageBounds<FlowerType> showFlowerTypeTable(FlowerType flowerType, int currentPage, int pageSize) {
		final int totalSize = baseMapper.getFlowerTypeCount(flowerType);
		PageBounds<FlowerType> pageBounds = new PageBounds<>(currentPage, totalSize, pageSize);
		List<FlowerType> list = baseMapper.selFlowerTypeByPage(flowerType, pageBounds.getOffset(), pageBounds.getPageSize());
		pageBounds.setPageList(list);
		return pageBounds;
	}

	@Override
	public FlowerType getFlowerTypeById(Integer fid) {
		return baseMapper.getFlowerTypeById(fid);
	}

	@Override
	public int updateFlowerType(FlowerType flowerType) {
		return baseMapper.updateFlowerType(flowerType);
	}

	@Override
	public int addFlowerType(FlowerType flowerType) {
		return baseMapper.addFlowerType(flowerType);
	}

	@Override
	public int delFlowerType(Integer fid) {
		return baseMapper.delFlowerType(fid);
	}

	@Override
	public int deleteFlowerTypes(List<Integer> ids) {
		return baseMapper.deleteFlowerTypes(ids);
	}

	@Override
	public int judgeType(List<Integer> fid) {
		return baseMapper.judgeType(fid);
	}

}
